Skip to content

Conversation

@junrushao
Copy link
Member

This PR makes IRModule printing deterministic by fix the function ordering. The "main" function always comes last, while other functions should be ordered alphabetically.

@tvm-bot
Copy link
Collaborator

tvm-bot commented Feb 11, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

Generated by tvm-bot

std::sort(functions.begin(), functions.end(), [](const auto& lhs, const auto& rhs) {
String lhs_name = lhs.first->name_hint;
String rhs_name = rhs.first->name_hint;
if (lhs_name == "main") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we can cache sort key by generating a tuple first then sort instead of doing string look up compare each time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Updated accordingly

This PR makes IRModule printing deterministic by fix the function
ordering. The "main" function always comes last, while other functions
should be ordered alphabetically.
@junrushao junrushao force-pushed the feature/2023-02-11/irmodule-func-ordering branch from 8ddf6c1 to adbf1f0 Compare February 12, 2023 07:37
@junrushao junrushao marked this pull request as ready for review February 12, 2023 07:39
@tqchen tqchen merged commit 8401bf6 into apache:main Feb 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants